package cn.wolfcode.wolf2w.business.controller;


import cn.wolfcode.wolf2w.business.service.ISmsService;
import cn.wolfcode.wolf2w.common.core.domain.R;
import cn.wolfcode.wolf2w.member.api.domain.UserInfo;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sms")
@Api(value = "sms短信操作的控制器接口",description = "SMS 资源控制器")
public class SmsController {

    @Autowired
    private ISmsService smsService;


    @ApiOperation(value = "发送验证码",notes = "给指定手机号码发送验证码")
    @ApiImplicitParam(value = "手机号",name = "phone",dataType = "String",required = true)
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功"),
            @ApiResponse(code = 500, message = "服务器内部错误"),
            @ApiResponse(code = 400, message = "参数不正确"),
            @ApiResponse(code = 404, message = "资源未找到"),
            @ApiResponse(code = 409, message = "资源冲突"),
            @ApiResponse(code = 201, message = "创建成功"),
            @ApiResponse(code = 401, message = "没登录"),
            @ApiResponse(code = 403, message = "没权限"),
            @ApiResponse(code = 501, message = "接口业务异常")
    })
    @PostMapping("/sendVerifyCode")
    public R<?> sendVerifyCode(String phone) {
        // 调用短信SDK发送验证码
        System.err.println(phone);
        smsService.sendVerifyCode(phone);
        return R.ok();
    }
}
